package com.chuan.it_market.pojo.dto;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class ResponseDTO {
    private String msg;
    private Boolean res;
    private Object data;
    private Integer status =200;
    private Integer errorCode;


    public static ResponseDTO ok(String msg){
        return new ResponseDTO(msg,true,null,200,null);

    }

    public static ResponseDTO ok(String msg,Object data){
        return new ResponseDTO(msg,true,data,200,null);
    }

    public static ResponseDTO fail(String msg,Object data,Integer status,Integer errorCode){
        return new ResponseDTO(msg,false,data,status,errorCode);
    }

    public static ResponseDTO fail(String msg){
        return new ResponseDTO(msg,false,null,null,null);

    }

}
